qiao-file
cmd
cp
'use strict';
var q = require('qiao-file');
var test = function(){
var folderPath = './test/';
var filePath = './qiao-file.js'
q.cp(folderPath, './test1');
q.cp(filePath, './1.js');
};
test();
mv
'use strict';
var q = require('qiao-file');
var test = function(){
var oldPath = './test';
var newPath = './test1'
var res = q.mv(oldPath, newPath);
console.log(res);
};
test();
rm
'use strict';
var q = require('qiao-file');
var test = function(){
var folderPath = 'd:/test1/';
var filePath = 'd:/test.png'
q.rm(folderPath);
q.rm(filePath);
};
test();
dir
lsdir
'use strict';
var q = require('qiao-file');
var test = function(){
var foldersAndFiles = q.lsdir('z:/workspaces/qiao.plugin.coder/');
console.log(foldersAndFiles);
};
test();
lstree
'use strict';
var q = require('qiao-file');
var test = function(){
var fileTree = q.lstree('./', ['node_modules']);
console.log(JSON.stringify(fileTree));
};
test();
mkdir
'use strict';
var q = require('qiao-file');
var test = function(){
var folder = 'd:/test1/test2/test3/test.js';
q.mkdir(folder);
};
test();
file
extname
'use strict';
var q = require('qiao-file');
var test = function(){
var filePath = 'd:/test1/test2/test.js';
var s = q.extname(filePath);
console.log(s);
};
test();
readFile
'use strict';
var q = require('qiao-file');
var test = function(){
var filePath = './index.js';
var s = q.readFile(filePath);
console.log(s);
};
test();
readFileLineByLine
'use strict';
var q = require('qiao-file');
async function test(){
var filePath = './rm.js';
q.readFileLineByLine(filePath, onLine, onClose);
}
test();
function onLine(line){
console.log(line);
}
function onClose(){
console.log('close');
}
readFileLineByLineSync
'use strict';
var q = require('qiao-file');
async function test(){
var filePath = './rm.js';
var lines = await q.readFileLineByLineSync(filePath);
console.log(lines);
filePath = null;
lines = null;
}
test();
writeFile
'use strict';
var q = require('qiao-file');
var test = function(){
var filePath = './1.js';
q.writeFile(filePath, '2');
};
test();
writeFileFromLines
'use strict';
var q = require('qiao-file');
async function test(){
var filePath = './rm.js';
var destPath = '../dist/rm.js';
var lines = await q.readFileLineByLineSync(filePath);
q.writeFileFromLines(destPath, lines);
filePath = null;
destPath = null;
lines = null;
};
test();
is
isExists
'use strict';
var q = require('qiao-file');
var test = function(){
var fpath = 'z:/workspaces/qiao.plugin.coder/lib/qiao.plugin.coder.js';
var s = q.isExists(fpath);
console.log(s);
};
test();
version
0.1.4.20220707
- write file from lines
- read file line by line
- read file line by line sync
0.1.3.20220420
- lstree path name
- mv
- write file
0.1.2.20220419
- es6
- add lstree
- read file
0.1.1.20220417
- add lerna
0.1.0.20220317
- add cp
0.0.9.20191204
- add funding
0.0.8.20191011
- exports.fs
- exports.path
0.0.7.20190122
- modify md
0.0.6.20190117
- extname to lower case
- add lsdir
- add rm
0.0.5.20190107
- nodejs file tool
0.0.4.20181127
- modify method name
- add .js
0.0.3.20181122
- npm audit
0.0.2.20181017
- isExists
- extname
- mkdir
- getAllFiles
0.0.1.20181016
- init